// const { ipcRenderer } = window.require('electron')
import { ipcRenderer } from 'electron'
// window.ipcRenderer = ipcRenderer
let winMidType = true

export default {
  test (val) {
    ipcRenderer.send('window-close', val)
  },
  login (val) {
    ipcRenderer.send('login', val)
  },
  closeLoginWin () {
    ipcRenderer.send('login-win-close')
  },
  windowAction (val) {
    if (val === 'min') {
      ipcRenderer.send('main-win-min')
    }
    if (val === 'close') {
      ipcRenderer.send('main-win-hide')
    }
    if (val === 'mid') {
      ipcRenderer.send(winMidType ? 'main-win-max' : 'main-win-narrow')
      winMidType = !winMidType
    }
  },
  updateView () {
    ipcRenderer.send('update-view')
  }
}
